using DNT.RavenQA.Core.Models;
using DNT.RavenQA.Web.Infrastructure.Extensions;
using Raven.Client.Document;

namespace DNT.RavenQA.Web.Infrastructure.Registry
{
    public static class DocumentConventionBuilder
    {
        public static void SetConventions(DocumentConvention conventions)
        {
            conventions.IdentityPartsSeparator = "-";
            conventions.JsonContractResolver = new IncludeNonPublicMembersContractResolver();
            conventions.FindTypeTagName = type => typeof (User).IsAssignableFrom(type)
                                                      ? typeof (User).Name.Pluralize()
                                                      : DocumentConvention.DefaultTypeTagName(type);
        }
    }
}